package com.ruoyi.oa.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.oa.mapper.LeaveTeacherMapper;
import com.ruoyi.oa.domain.LeaveTeacher;
import com.ruoyi.oa.service.ILeaveTeacherService;
import com.ruoyi.common.core.text.Convert;

/**
 * 教师请假Service业务层处理
 * 
 * @author 张艳羽
 * @date 2024-10-10
 */
@Service
public class LeaveTeacherServiceImpl implements ILeaveTeacherService 
{
    @Autowired
    private LeaveTeacherMapper leaveTeacherMapper;

    /**
     * 查询教师请假
     * 
     * @param id 教师请假主键
     * @return 教师请假
     */
    @Override
    public LeaveTeacher selectLeaveTeacherById(Long id)
    {
        return leaveTeacherMapper.selectLeaveTeacherById(id);
    }

    /**
     * 查询教师请假列表
     * 
     * @param leaveTeacher 教师请假
     * @return 教师请假
     */
    @Override
    public List<LeaveTeacher> selectLeaveTeacherList(LeaveTeacher leaveTeacher)
    {
        return leaveTeacherMapper.selectLeaveTeacherList(leaveTeacher);
    }

    /**
     * 新增教师请假
     * 
     * @param leaveTeacher 教师请假
     * @return 结果
     */
    @Override
    public int insertLeaveTeacher(LeaveTeacher leaveTeacher)
    {
        leaveTeacher.setCreateTime(DateUtils.getNowDate());
        return leaveTeacherMapper.insertLeaveTeacher(leaveTeacher);
    }

    /**
     * 修改教师请假
     * 
     * @param leaveTeacher 教师请假
     * @return 结果
     */
    @Override
    public int updateLeaveTeacher(LeaveTeacher leaveTeacher)
    {
        leaveTeacher.setUpdateTime(DateUtils.getNowDate());
        return leaveTeacherMapper.updateLeaveTeacher(leaveTeacher);
    }

    /**
     * 批量删除教师请假
     * 
     * @param ids 需要删除的教师请假主键
     * @return 结果
     */
    @Override
    public int deleteLeaveTeacherByIds(String ids)
    {
        return leaveTeacherMapper.deleteLeaveTeacherByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除教师请假信息
     * 
     * @param id 教师请假主键
     * @return 结果
     */
    @Override
    public int deleteLeaveTeacherById(Long id)
    {
        return leaveTeacherMapper.deleteLeaveTeacherById(id);
    }

    @Override
    public int updateLeaveTeaStatus(String status, String ids) {
        return leaveTeacherMapper.updateLeaveTeaStatus(status, Convert.toStrArray(ids));
    }
}
